package com.studyspringcloud.product.VO;

import lombok.Data;

@Data
public class ResultVO<T> {

    public static  String success_str = "成功";
    public static  String error_str = "错误";
    /**
     * 错误码
     */
    private Integer code;

    /**
     * 提示信息
     */
    private String msg;

    /**
     * 具体类容
     */
    private T data;

    public static <T> ResultVO<T> suceess(T data){
        ResultVO vo = new ResultVO();
        vo.setCode(0);
        vo.setMsg(success_str);
        vo.setData(data);
        return vo;
    }


    public static <T> ResultVO<T> error(T data){
        ResultVO vo = new ResultVO();
        vo.setCode(-1);
        vo.setMsg(error_str);
        vo.setData(data);
        return vo;
    }


}
